<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../common/hello-common-head.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

		<div class="main-container-inner">
			
			<a class="menu-toggler" id="menu-toggler" href="#"> <span
				class="menu-text"></span>
			</a>
			<div class="sidebar" id="sidebar">
				<script type="text/javascript">
					try {
						ace.settings.check('sidebar', 'fixed')
					} catch (e) {
					}
				</script>
				<div class="sidebar-shortcuts" id="sidebar-shortcuts">
					<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
						<button class="btn btn-success">
							<i class="icon-signal"></i>
						</button>
						<button class="btn btn-info">
							<i class="icon-pencil"></i>
						</button>
						<button class="btn btn-warning">
							<i class="icon-group"></i>
						</button>
						<button class="btn btn-danger">
							<i class="icon-cogs"></i>
						</button>
					</div>
					<div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
						<span class="btn btn-success"></span> <span class="btn btn-info"></span>
						<span class="btn btn-warning"></span> <span class="btn btn-danger"></span>
					</div>
				</div>
				<!-- #sidebar-shortcuts -->
				<ul class="nav nav-list">
					<li class="open" ><a href="#" class="dropdown-toggle"> <i
							class="icon-desktop"></i> <span class="menu-text"> 工单管理 </span> <b
							class="arrow icon-angle-down"></b>
					</a>
						<ul class="submenu" style="display: block;">
							<li class = "active"><a
								href="${pageContext.request.contextPath}/workbase/searchbase">
									<i class="icon-double-angle-right"></i> 基础服务
							</a></li>
							<li ><a href="${pageContext.request.contextPath}/workbase/reportgenerate"> <i
									class="icon-double-angle-right"></i> 报表生成
							</a></li>
							<li><a href="${pageContext.request.contextPath}/workbase/dailyreportgenerate"> <i
									class="icon-double-angle-right"></i> 日报报表生成
							</a></li>
							<li><a href="#"> <i
									class="icon-double-angle-right"></i> 其他功能
							</a></li>
						</ul></li>
					<li><a href="#" class="dropdown-toggle"> <i
							class="icon-desktop"></i> <span class="menu-text"> 其他需求 </span> <b
							class="arrow icon-angle-down"></b>
					</a>
						<ul class="submenu">
							<li><a href="#" > <i
									class="icon-double-angle-right"></i> 工单管理
							</a></li>
							<li><a href="#"> <i
									class="icon-double-angle-right"></i> 其他需求
							</a></li>
						</ul></li>
				</ul>
				<!-- /.nav-list -->
				<div class="sidebar-collapse" id="sidebar-collapse">
					<i class="icon-double-angle-left"
						data-icon1="icon-double-angle-left"
						data-icon2="icon-double-angle-right"></i>
				</div>
				<script type="text/javascript">
					try {
						ace.settings.check('sidebar', 'collapsed')
					} catch (e) {
					}
				</script>
			</div>
			
			<div class="main-content">
				<div class="breadcrumbs" id="breadcrumbs">
					<script type="text/javascript">
						try {
							ace.settings.check('breadcrumbs', 'fixed')
						} catch (e) {
						}
					</script>
					<ul class="breadcrumb">
						<li><i class="icon-home home-icon"></i> <a href="${pageContext.request.contextPath}/iuser/hello">控制台</a>
						</li>
						<li class="active">基础服务</li>
					</ul>
				</div>
<div class="page-content">
 <!-- <div class="page-header">
		<div class="col-xs-12">
			<table>
				<tr>
					<td>
						<p>
							开始时间: <input type="date" id="intim1" value=""/>
						</p>
					</td>
					<td>
						<p>
							结束时间: <input type="date" id="intim2" value=""/>
						</p>
					</td>
					<td>
						<p>工单类型：
							<select id="sec_ws_type">
								<option value="0" selected="selected">全部</option>
								<option value="1">退款方面</option>
								<option value="2">支付方面</option>
								<option value="3">账户咨询</option>
								<option value="4">咨询返现</option>
								<option value="5">实名问题</option>
								<option value="6">错误工单</option>
								<option value="7">其他</option>
							</select>
						</p>
					</td>
					<td>
						<p>工单细分：
							<select id="sec_ws_detail">
								<option value="0">全部</option>
							</select>
						</p>
					</td>
				</tr>
				<tr>
					<td>
					<p>业务类型：
							<select id="sec_trade_type">
							<option value="0">全部</option>
							<option value="1">机票</option>
							<option value="2">酒店</option>
					</select>
						</p>
					</td>
					<td>
						<p>处理人：
							<select id="sec_deal_person">
								<option value="0">全部</option>
								<option value="1">李成博</option>
								<option value="2">王进洛</option>
								<option value="3">李瑞昊</option>
								<option value="4">赵佳琪</option>
							</select>
						</p>
					</td>
					<td>
						<p>工单号：
							<input type="text" id="sec_ws_num" value="">
						</p>
					</td>
					<td>
						<p>备注：
							<select id="sec_is_wscommont">
								<option value="0">全部</option>
								<option value="1">是</option>
								<option value="-1">否</option>
							</select>
						</p>
					</td>
					<td>
						<button onclick="paginationClick()">查询</button>
					</td>
					<td></td>
					<td>
						<button onclick ="emptySecCondition()">清空</button>
					</td>
					<td></td>
					<td>
						<button id="exc_exp">导出</button>
					</td>
				</tr>
			</table>

		</div>
	</div>  -->
	<div class="row">
		<div class="col-xs-12">
	
						<div class="row">
						<div class="col-sm-3" align="center">
							开始时间 :<input type="date" id="intim1" value=""
								style="width: 200px;" />
						</div>
						<div class="col-sm-3" align="center">
							结束时间 :<input type="date" id="intim2" value=""
								style="width: 200px;" />
						</div>
						<div class="col-sm-3" align="center">
							工单类型：&nbsp;<select name="sec_ws_type" id="sec_ws_type"
								style="width: 200px;">
								<option value="0" selected="selected">全部</option>
								<option value="1">退款方面</option>
								<option value="2">支付方面</option>
								<option value="3">账户咨询</option>
								<option value="4">咨询返现</option>
								<option value="5">实名问题</option>
								<option value="6">错误工单</option>
								<option value="7">其他</option>
							</select>
						</div>
						<div class="col-sm-3" align="center">
							工单细分：<select name="sec_ws_detail" id="sec_ws_detail"
								style="width: 200px;">
								<option value="0">全部</option>
							</select>
						</div>
						<!-- <div class="col-sm-4" align="left">
							<button class="btn btn-primary" onclick="secWorksheetChart()">生成</button>
							<button class="btn btn-primary" onclick="delSecCondition()">清空</button>
						</div> -->
					</div>
					
					<div class="space-12"></div>
						<div class="row">
						<div class="col-sm-3" align="center">
							业务类型 :&nbsp;<select name="sec_trade_type" id="sec_trade_type"
								style="width: 200px;">
								<option value="0">全部</option>
								<option value="1">机票</option>
								<option value="2">酒店</option>
							</select>
						</div>
							<div class="col-sm-3" align="center">
							&nbsp;&nbsp;&nbsp;处理人:<select name="sec_deal_person" id="sec_deal_person"
								style="width: 200px;">
								<option value="0">全部</option>
								<option value="1">李成博</option>
								<option value="2">王进洛</option>
								<option value="3">李瑞昊</option>
								<option value="4">赵佳琪</option>
							</select>
						</div>
						<div class="col-sm-3" align="center">
							工单号：<input type="text" id="sec_ws_num" value="">
						</div>
							<div class="col-sm-3" align="center">
							&nbsp;&nbsp;&nbsp;备注：<select name="sec_is_wscommont" id="sec_is_wscommont"
								style="width: 200px;">
								<option value="0">全部</option>
								<option value="1">是</option>
								<option value="-1">否</option>
							</select>
						</div>
					</div>
					<div class="space-12"></div>
						<div class="row">
		<div class="col-sm-12" align="center">
							<button class="btn btn-sm btn-primary" onclick="secWorksheetChart()">生成</button>
							<button class="btn btn-sm btn-primary" onclick="delSecCondition()">清空</button>
						</div>
						</div>
			<div class="row">
			<h3 class="header smaller lighter blue">工单报表</h3>
			<div class="table-header">
				工单详细信息列表 <a style="text-align: left; color: red"
					class="tooltip-info" data-rel="tooltip"> </a> <a  onclick="clickAdd()" id="ws-add"
					 title="新增"> <span class="black">
					    <button style='font-weight:bold'>+++</button>
				</span>
				</a>

			</div>

			<div class="table-responsive">
				<form class="form-inline">
					<table id="sample-table-2"
						class="table table-striped table-bordered table-hover">
						<tr>
							<th>序号</th>
							<th>工单号</th>
							<th>业务类型</th>
							<th>工单类型</th>
							<th>工单类型细分</th>
							<th>日期</th>
							<th>处理人</th>
							<th>备注</th>
							<th>操作</th>
						</tr>

						<tbody id="ws-body-all">
						</tbody>
						</table>
						当前页<span class="badge" id="currentPage"></span> 总记录数<span class="badge" id="totalRecords"></span> 总页数<span class="badge" id="totalPages"></span>
						<ul class="pagination" style="float:right">
								<li><a onclick="paginationClick(1)">&laquo;</a></li>
								<li><a onclick="paginationClick(2)">上一页</a></li>
								<li><a onclick="paginationClick(3)">下一页</a></li>
								<li><a onclick="paginationClick(4)">&raquo;</a></li>
						</ul>
					
				</form>
			</div>
			<!-- 模态框（Modal） -->
			<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
				aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" id="edit_btn" value="" class="close"
								data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">请编辑需要修改的内容</h4>
						</div>
						<div class="modal-body">
							备注：<input type="text" name="edit_comment" id="edit_comment" />
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default"
								data-dismiss="modal">关闭</button>
							<button type="button" onclick="editSgComment()"
								class="btn btn-primary">提交更改</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- table-responsive ends -->
		</div>
	</div>
</div>
				<!-- /.main-content -->
</div>
<%@ include file="../common/hello-common-tail.jsp"%>
<!-- inline scripts related to this page -->
<script type="text/javascript">
	$(function() {
		
		paginationClick(1);
	});
	function secWorksheet() {
		//初始化系统时间
		gencurrentdate();
		var beginDate = $("#intim1").val();
		var endDate = $("#intim2").val();

		var secWsType = $("#sec_ws_type").val();
		var secWsDetail = $("#sec_ws_detail").val();

		var secTradeType = $("#sec_trade_type").val();
		var secDealPerson = $("#sec_deal_person").val();

		var secWsNum = $("#sec_ws_num").val();
		var secIsWscommont = $("#sec_is_wscommont").val();

		var conditionData = {
			"beginDate" : beginDate,
			"endDate" : endDate,
			"secWsType" : secWsType,
			"secWsDetail" : secWsDetail,
			"secTradeType" : secTradeType,
			"secDealPerson" : secDealPerson,
			"secWsNum" : secWsNum,
			"secIsWscommont" : secIsWscommont
		}
		$.ajax({
					type : "GET",
					url : "${pageContext.request.contextPath}/workbase/secworksheetbase",
					async : false,
					data : conditionData,
					success : function(result) {
						loadTableData(result.data);
					},
					error : function() {
						alert("没有数据或者数据查询失败");
					}
				});
	};
	
	// 分页查询
	function paginationClick(pageOpt) {
		//初始化系统时间
		gencurrentdate();
		var beginDate = $("#intim1").val();
		var endDate = $("#intim2").val();

		var secWsType = $("#sec_ws_type").val();
		var secWsDetail = $("#sec_ws_detail").val();

		var secTradeType = $("#sec_trade_type").val();
		var secDealPerson = $("#sec_deal_person").val();

		var secWsNum = $("#sec_ws_num").val();
		var secIsWscommont = $("#sec_is_wscommont").val();
		
		var currentPage = parseInt($("#currentPage").text());
		var totalPages = parseInt($("#totalPages").text());
		var pageNum = 1;
		
		//获取元素个数
		var totalNum =parseInt($("#totalRecords").text());
		if(pageOpt == 1){  //开始页
			pageNum = 1;
		} else if(pageOpt == 2){ //上一页
			pageNum = currentPage - 1;
			if(pageNum == 0) {
				return;
			}
		} else if(pageOpt == 3){ //下一页
			pageNum = currentPage + 1;
			if(pageNum == totalPages + 1) {
				return;
			}
		} else if(pageOpt == 4){ //结束页
			pageNum = totalPages;
		} else if(pageOpt == 5){ //当前页
			pageNum =  currentPage;
		} else if(pageOpt == 6){  // 增加项（尾页）
			if(totalNum%10 == 0){
				pageNum = totalPages+1;
			}else{
				pageNum = totalPages;
			}
		} else if(pageOpt == 7){ //删除项(尾页)
			if(totalNum%10 == 1 && currentPage == totalPages){
				pageNum = totalPages - 1;
			}else{
				pageNum = currentPage;
			}
			
		}
		var ajaxData = {
				"beginDate" : beginDate,
				"endDate" : endDate,
				"secWsType" : secWsType,
				"secWsDetail" : secWsDetail,
				"secTradeType" : secTradeType,
				"secDealPerson" : secDealPerson,
				"secWsNum" : secWsNum,
				"secIsWscommont" : secIsWscommont,
				"pageNum" : pageNum
				};
		$.ajax({
			   type: "GET",
			   url: "${pageContext.request.contextPath}/workbase/secworksheetbase",
			   async: false,
			   data:ajaxData,
			   success: function(result){
					    loadTableData(result.data);
			   },
			   error : function() {
				   alert("系统异常，请联系管理员");
			   }
			});
	}
	//清空数据
	function delAllWorksheet(){
		var beginDate = $("#intim1").val();
		var endDate = $("#intim2").val();

		var secWsType = $("#sec_ws_type").val();
		var secWsDetail = $("#sec_ws_detail").val();

		var secTradeType = $("#sec_trade_type").val();
		var secDealPerson = $("#sec_deal_person").val();

		var secWsNum = $("#sec_ws_num").val();
		var secIsWscommont = $("#sec_is_wscommont").val();

		var conditionData = {
			"beginDate" : beginDate,
			"endDate" : endDate,
			"secWsType" : secWsType,
			"secWsDetail" : secWsDetail,
			"secTradeType" : secTradeType,
			"secDealPerson" : secDealPerson,
			"secWsNum" : secWsNum,
			"secIsWscommont" : secIsWscommont
		}
		$.ajax({
					type : "GET",
					url : "${pageContext.request.contextPath}/workbase/dellistbase",
					async : false,
					data : conditionData,
					success : function(result) {
						alert("清空数据成功!");
						loadTableData(result);
					},
					error : function() {
						alert("没有需要删除的数据!");
					}
				});
		
	}
	//清空查询条件
	function emptySecCondition(){
		var sysDate = new Date();
		var sysYear = sysDate.getFullYear();
		var sysMonth = sysDate.getMonth()+1;
		var sysDay_f = sysDate.getDate();
		if(parseInt(sysDay_f)<10){
			var sysDay_t = 0+""+sysDay_f;
		}else{
			var sysDay_t = sysDay_f;
		}
	    $("#intim1").val(sysYear+"-"+sysMonth+"-"+sysDay_t);
		$("#intim2").val(sysYear+"-"+sysMonth+"-"+sysDay_t);

		$("#sec_trade_type").val("0");
		$("#sec_deal_person").val("0");
		

		$("#sec_ws_type").val("0");
		$("#sec_ws_detail").val("0");


		$("#sec_ws_num").val("");
	    $("#sec_is_wscommont").val("0");
		
	}
	jQuery(function($) {
		$("#exc_exp")
				.on(
						"click",
						function() {
							var beginDate = $("#intim1").val();
							var endDate = $("#intim2").val();
							var worksheetType = $("#sec_ws_type").val();
							var wsTypeDetail = $("#sec_ws_detail").val();

							var businessType = $("#sec_trade_type").val();
							var dealPerson = $("#sec_deal_person").val();

							var jobNum = $("#sec_ws_num").val();
							var wsComment = $("#sec_is_wscommont").val();

							var excData = {
								"beginDate" : beginDate,
								"endDate" : endDate,
								"job_num" : jobNum,
								"business_type" : businessType,
								"worksheet_type" : worksheetType,
								"ws_type_detail" : wsTypeDetail,
								"deal_person" : dealPerson,
								"ws_comment" : wsComment
							}
							$
									.ajax({
										type : "GET",
										url : "${pageContext.request.contextPath}/workbase/exportexcel",
										async : false,
										data : excData,
										success : function(result) {
											document.location.href = "${pageContext.request.contextPath}/workbase/expdownload/"
													+ excData;
										},
										error : function() {
											alert("数据插入失败");
										}
									});

						})
	});
	
	function clickAdd(){
		var num = $("#ws-body-all").children('tr').length;
		var c_date = new Date().getFullYear() + "-"
				+ (new Date().getMonth() + 1) + "-"
				+ new Date().getDate();
		var add_line = "<tr><td>"
				+ (Number(num) + 1)
				+ "</td>"
				+ "										<td><input id='savesinglejobnum' name='job_num'  type='text'/></td>"
				+ "										<td>"
				+ "											<select id='savesinglebt' name='business_type'>"
				+ "												<option value='0'>请选择</option>"
				+ "												<option value='1'>机票</option>"
				+ "												<option value='2'>酒店</option>"
				+ "											</select>"
				+ "										</td>"
				+ "										<td>"
				+ "											<select name='worksheet_type' id='savewstype' onchange='wsTypeChange()'><option value='0'>请选择</option><option value='1'>退款方面</option>"
				+ "											<option value='2'>支付方面</option><option value='3'>账户咨询</option><option value='4'>咨询返现</option>"
				+ "											<option value='5'>实名问题</option><option value='7'>其他</option><option value='6'>错误工单</option>"
				+ "											</select>"
				+ "										</td>"
				+ "										<td>"
				+ "											<select name='ws_type_detail' id='savesinglewstd'>"
				+ "												<option value = '0'>请选择</option>			"	
				+ "											</select>"
				+ "										</td>"
				+ "										<td><textarea id = 'savesinglect' rows='1' cols='10' name ='create_time'>"
				+ c_date
				+ "</textarea></td>"
				+ "										<td>"
				+ "				<select id='savesingledp'> "
				+ "					<option value='0'>请选择</option> "
				+ "					<option value='1'>李成博</option> "
				+ "					<option value='2'>王进洛</option> "
				+ "					<option value='3'>李瑞昊</option> "
				+ "					<option value='4'>赵佳琪</option> "
				+ "				</select></td>"
				+ "										<td><input id='savesinglewsc' name='ws_comment' type='text' name='备注'/></td>"
				+ "										<td><button type='button' onclick='saveSingleWS()' id='savesinglebase'>保存</button></td></tr>";
		$("#ws-body-all").prepend(add_line);
	};
	function wsTypeChange(){
		var ws_type = $("#savewstype").val(); 
		$.ajax({
			type:"GET",
			url:"${pageContext.request.contextPath}/workbase/secwsdetail",
			data:{'ws_type':ws_type},
			success:function(result){
				var data = result.data;
				if(data!= null && data.length >0){
					var option_add ="";
					for(var i=0;i<data.length;i++){
						option_add +=" <option value='"+data[i].type+"'>"+data[i].value+"</option>";
					}
					$("#savesinglewstd").empty();
					$("#savesinglewstd").append(option_add);
				}
				
			}
		});
	}
	
	jQuery(function($) {
		$("#sec_ws_type").change(function(){
			var ws_type = $("#sec_ws_type").val(); 
			$.ajax({
				type:"GET",
				url:"${pageContext.request.contextPath}/workbase/secwsdetail",
				data:{'ws_type':ws_type},
				success:function(result){
					var data = result.data;
					if(data!= null && data.length >0){
						var option_add ="";
						for(var i=0;i<data.length;i++){
							option_add +=" <option value='"+data[i].type+"'>"+data[i].value+"</option>";
						}
						$("#sec_ws_detail").empty();
						$("#sec_ws_detail").append(option_add);
					}
					
				}
			});
			
		});
	});
	
	function saveSingleWS() {
		var jobNum = $("#savesinglejobnum").val();
		var businessType = $("#savesinglebt").val();
		var worksheetType = $("#savewstype").val();
		var wsTypeDetail = $("#savesinglewstd").val();
		var createTime = $("#savesinglect").val();
		var dealPerson = $("#savesingledp").val();
		var wsComment = $("#savesinglewsc").val();

		if(jobNum==null || jobNum==undefined || jobNum == ''){
			alert("请填写工单号！");
			return false;
		}
		if(businessType == '0'){
			alert("请选择业务类型！");
			return false;
		}
		if(savewstype == '0'){
			alert("请选择工单类型！");
			return false;
		}
		if(wsTypeDetail == '0'){
			alert("请选择工单类型细分！");
			return false;
		}
		if(dealPerson == '0'){
			alert("请选择处理人！");
			return false;
		}
		var ajaxData = {
			"job_num" : jobNum,
			"business_type" : businessType,
			"worksheet_type" : worksheetType,
			"ws_type_detail" : wsTypeDetail,
			"create_time" : createTime,
			"deal_person" : dealPerson,
			"ws_comment" : wsComment
		}
		$.ajax({
			type : "GET",
			url : "${pageContext.request.contextPath}/workbase/insinglebase",
			async : false,
			data : ajaxData,
			success : function(result) {
				paginationClick(6);
			},
			error : function() {
				alert("数据插入失败");
			}
		});
	}

	// 拼装table数据
	function loadTableData(data) {

		$("#ws-body-all").empty();
		$("#ws-body-all").html("");
		
		var lines = data.data;
		var pageNum = data.pageNum;
		var pageSize = data.pageSize;
		var totalCount = data.totalCount;
		
		for (var i = 0; i < lines.length; i++) {
			var line = '<tr>' + '<td >'
					+ (Number(i) + 1)
					+ '</td>'
					+ '<td >'
					+ lines[i].job_num
					+ '</td>'
					+ '<td >'
					+ lines[i].business_type
					+ '</td>'
					+ '<td >'
					+ lines[i].worksheet_type
					+ '</td>'
					+ '<td >'
					+ lines[i].ws_type_detail
					+ '</td>'
					+ '<td >'
					+ lines[i].create_time
					+ '</td>'
					+ '<td >'
					+ lines[i].deal_person
					+ '</td>'
					+ '<td id= "td'+lines[i].id+'">'
					+ lines[i].ws_comment
					+ '</td>'
					+ ' <div id="comment'+lines[i].id+'" style="display:none">'
					+ '	内容：<input id="text'+lines[i].id+'" type="text" name="name" value="111">'
					+ '	<input type="button" onclick="saveComment('
					+ lines[i].id
					+ ')" value="保存">'
					+ '	</div>'
					+ '<td>'
					+ '<div'
					+  'class="visible-md visible-lg hidden-sm hidden-xs action-buttons">'
					+ '<a class="green" href="javascript:void(0)" onclick ="editInfo('
					+ lines[i].id
					+ ')" data-toggle="modal" data-target="#myModal"> <i'
					+  '	class="icon-pencil bigger-130"></i>'
					+ '</a> <a class="red" href="javascript:void(0)"  onclick =delwsA('
					+ lines[i].id
					+ ')> <i class="icon-trash bigger-130"></i>'
					+ '</a>'
					+ '</div>'
					+ '<div class="visible-xs visible-sm hidden-md hidden-lg">'
					+ '<div class="inline position-relative">'
					+ '	<button class="btn btn-minier btn-yellow dropdown-toggle"'
					+  '		data-toggle="dropdown">'
					+ '		<i class="icon-caret-down icon-only bigger-120"></i>'
					+ '	</button>'
					+ '	<ul'
					+  '		class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">'
					+ '		<li><a  class="tooltip-success"'
					+  '			data-rel="tooltip" title="Edit"> <span class="green">'
					+ '					<i class="icon-edit bigger-120"></i>'
					+ '			</span>'
					+ '		</a></li>'
					+ '		<li><a  class="tooltip-error" data-rel="tooltip"'
					+  '			title="Delete"> <span class="red"> <i'
					+  '					class="icon-trash bigger-120"></i>'
					+ '			</span>' + '		</a></li>' + '	</ul>' + '</div>'
					+ '</div>' + '</tr>';
			$("#ws-body-all").prepend(line);
		}
		//分页
		$("#currentPage").html( pageNum);
		$("#totalRecords").html( totalCount );
		$("#totalPages").html( Math.ceil(totalCount/pageSize) );
	}
	// 拼装table数据
	function delwsA(wsId) {
		var delData = {
			"ws_id" : wsId
		}
		$.ajax({
			type : "GET",
			url : "${pageContext.request.contextPath}/workbase/delsinglebase",
			async : false,
			data : delData,
			success : function(result) {
				alert("数据删除成功！");
				paginationClick(7);
			},
			error : function() {
				alert("数据插入失败");
			}
		});
	}
	//修改单一数据备注
	function editSgComment() {
		var ws_id = $("#edit_btn").val();
		var ws_comment = $("#edit_comment").val();
		editData = {
			"ws_id" : ws_id,
			"ws_comment" : ws_comment
		}
		$.ajax({
			type : "GET",
			url : "${pageContext.request.contextPath}/workbase/editsinglebase",
			async : false,
			data : editData,
			success : function(result) {
				paginationClick(5);
			},
			error : function() {
				alert("数据修改失败");
			}
		});
	}
	//显示编辑备注弹窗
	function editComment(commentId) {
		$("#" + ("comment" + commentId)).show();
	}
	//模态框
	function editInfo(obj) {
		$("#edit_btn").val(obj);
	}
	//初始化为当前系统时间
	function gencurrentdate(){
		var beginDate =$("#intim1").val();
		var endDate =$("#intim2").val();
		
		var sysDate = new Date();
		var sysYear = sysDate.getFullYear();
		var sysMonth = sysDate.getMonth()+1;
		var sysDay_f = sysDate.getDate();
		if(parseInt(sysDay_f)<10){
			var sysDay_t = 0+""+sysDay_f;
		}else{
			var sysDay_t = sysDay_f;
		}
		if(beginDate==null || beginDate==undefined || beginDate == ''){
			$("#intim1").val(sysYear+"-"+sysMonth+"-"+sysDay_t);
		}
		if(endDate==null || endDate==undefined || endDate == ''){
			$("#intim2").val(sysYear+"-"+sysMonth+"-"+sysDay_t);
		}
	}
</script>